package com.ruoyi.forum.dao;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.forum.domain.CircleTopic;
import com.ruoyi.forum.mapper.CircleTopicMapper;
import com.ruoyi.forum.model.UnReadResult;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * DAO
 *
 * @author lxk
 * @date 2018-10-17 10:04:33
 */
@Repository
public class CircleTopicDao extends ServiceImpl<CircleTopicMapper, CircleTopic> {

    @Resource
    private CircleTopicMapper circleTopicMapper;

    public List<CircleTopic> getTopicOfMe(Integer pageNo, Integer rows, String uid) {
        // 使用 MyBatis-Plus 的分页参数
        int pageFirst = (pageNo - 1) * rows;
        return circleTopicMapper.getTopicOfMe(uid, rows, pageFirst);
    }

    public long getTopicOfMeCount(String uid) {
        return circleTopicMapper.getTopicOfMeCount(uid);
    }

    public List<UnReadResult> getTopicUnreadListSearch(String uid, Long startTime, Long endTime, int pageSize, int first) {
        // 这里需要在 XML 中实现对应的查询
        // 暂时返回空列表，后续需要实现具体逻辑
        return new ArrayList<>();
    }
}